use super::agent::{AgentChatRequestMessage, AgentChatResponseMessage};

use derive_builder::Builder;
use serde::{Deserialize, Serialize};

use crate::{
    database::DataSource,
    error::Error,
    modeling::application::{ApplicationConversation, ApplicationConversationMessage},
};

#[derive(Debug, Default, Serialize, Deserialize, Clone, Builder, PartialEq)]
#[builder(name = "FetchOptionsBuilder")]
#[builder(pattern = "mutable")]
#[builder(setter(into, strip_option), default)]
#[builder(derive(Debug))]
#[builder(build_fn(error = "Error"))]
pub struct FetchOptions {
    pub limit: Option<u32>,
    pub page: Option<u32>,
    pub page_size: Option<u32>,
}

#[async_trait::async_trait]
pub trait ApplicationHandler {
    //
    async fn agent_chat_request(
        &self,
        request_message: AgentChatRequestMessage,
    ) -> anyhow::Result<AgentChatResponseMessage>;

    //
    async fn application_datasource(&self) -> anyhow::Result<Option<DataSource>>;
}
